﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;

namespace xTeam.HengLe.Helper
{
    public static class SiteMapPathHelper
    {
        /// <summary>
        /// 输出 SiteMapPath
        /// </summary>
        /// <param name="html">HtmlHelper</param>
        /// <returns>string</returns>
        public static string SiteMapPath(this HtmlHelper html)
        {
            List<string> urls = (List<string>)html.ViewData["SiteMapPath"];
            const string em = "<em>></em>";
            StringBuilder sb = new StringBuilder(urls.Count);

            foreach (string s in urls)
            {
                sb.Append(s);
                if (s != urls.Last())
                {
                    sb.Append(em);
                }
            }
            return sb.ToString();
        }
    }
}
